package com.neusoft.elmboot.controller;

import java.math.BigDecimal;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.neusoft.elmboot.po.Orders;
import com.neusoft.elmboot.po.VirtualWallet;
import com.neusoft.elmboot.po.VirtualWalletTransaction;
import com.neusoft.elmboot.service.VirtualWalletService;

@RestController
@RequestMapping("/VirtualWallet")
public class VirtualWalletController {
	@Autowired
	private VirtualWalletService virtualWalletService;

	//根据用户编号查询虚拟钱包
	@GetMapping("/{userId}")
	public VirtualWallet getVirtualWalletByUserId(@PathVariable String userId) throws Exception{
		return virtualWalletService.getVirtualWalletByUserId(userId);
	}
	
	@PutMapping
	public int updateVirtualWallet(@RequestBody VirtualWallet virtualWallet) throws Exception{
		return virtualWalletService.updateBalance(virtualWallet);
	}
	
}